//
//  CJBZSDKManagerAdapter.m
//  Pods
//
//  Created by shanghailingye on 2025/10/20.
//

#import "CJBZSDKManagerAdapter.h"

@implementation CJBZSDKManagerAdapter

static AdScopeMediationAdapterInitSDKState _initState = kAdScopeMediationAdapterInitSDKStateNormal;

+ (AdScopeMediationAdapterInitSDKState)initState {
    return _initState;
}

+ (void)setInitState:(AdScopeMediationAdapterInitSDKState)initState {
    _initState = initState;
}

+ (void)startAsyncWithAppId:(NSString *)appId
              configuration:(AMPSAdSDKConfiguration *)configuration
                    results:(AMPSCustomAdapterSDKInitStatusResults)adapterResult {
    CJBZSDKManagerAdapter.initState = kAdScopeMediationAdapterInitSDKStateLoad;
    [CJADManager openDebugLog];
    [CJADManager configure:appId completeHandle:^(BOOL success, NSError * _Nullable error) {
        if (success) {
            CJBZSDKManagerAdapter.initState = kAdScopeMediationAdapterInitSDKStateSuccess;
        } else {
            if (CJBZSDKManagerAdapter.initState != kAdScopeMediationAdapterInitSDKStateSuccess) {
                CJBZSDKManagerAdapter.initState = kAdScopeMediationAdapterInitSDKStateFail;
            }
        }
        adapterResult(success);
    }];
}

+ (void)setPersonalizedRecommendState:(BOOL)state {
    [CJADManager setEnablePersonalRecommend:!state];
}

+ (NSString *)sdkVersion {
    return [CJADManager version];
}

+ (nonnull NSString *)adapterVersion {
    return CJAdpterVersion;
}

@end
